﻿namespace ChessKit.Logic
{
	public struct MadeMove
	{
		public PieceType Promotion { get; private set; }

		public Square From { get { return Move.From; } }
		public Square To { get { return Move.To; } }
		public Move Move { get; private set; }
		public Board BoardBefore { get; private set; }
		public ProtoBoard BoardAfter { get; private set; }
		public MoveHints Hints { get; private set; }
		public int Number { get { return BoardBefore.MoveNumber; } }
		public override string ToString() { return Move.ToString(); }

		public MadeMove(Board boardBefore, HintedMove move, PieceType promotion, ProtoBoard boardAfter)
			: this()
		{
			Promotion = promotion;
			Move = move.Move;
			BoardBefore = boardBefore;
			BoardAfter = boardAfter;
			Hints = move.Hints;
		}

		public MadeMove(Board boardBefore, HintedMove move, PieceType promotion)
			: this()
		{
			Promotion = promotion;
			Move = move.Move;
			BoardBefore = boardBefore;
			Hints = move.Hints;
			BoardAfter = new ProtoBoard(boardBefore, move.Move, move.Hints, promotion);
		}
	}
}